<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <title>Projeto Final</title>
    </head>
    <body>

        <div>
            <h2>Login</h2>
            <div>
                <?php
                if (!Login::singleton()->estaConectado()) {
                    ?>
                    <form method="POST">
                        <input type="email" name="edtEmail" required="required"/>
                        <input type="password" name="edtSenha" required="required"/>
                        <button type="submit" name="formLogin" value="formLogin">Fazer Login</button>
                    </form>
                    <?php
                } else {
                    ?>
                    <form method="POST">
                        <button type="submit" name="formLogout" value="formLogout">Fazer Logout</button>
                    </form>
                    <?php
                }
                ?>
            </div>

            <div>
                <h2>Cadastro Usuario</h2>
                <div>
                    <form method="POST">
                        <input type="text" name="edtNome" required="required" placeholder="Nome"/>
                        <input type="text" name="edtCpf" required="required" placeholder="CPF"/>
                        <input type="text" name="edtRg" required="required" placeholder="RG"/>
                        <input type="email" name="edtEmail" required="required" placeholder="email@email.com"/>
                        <input type="password" name="edtSenha" required="required" placeholder="Senha"/>
                        <button type="submit" name="formCadastro" value="formCadastro">Cadastrar</button>
                    </form>
                </div>
            </div>
            <h1>Eventos</h1>
            <div>
                <?php
                if (Login::singleton()->estaConectado()) {
                    if (is_a(Login::singleton()->getUsuario(), 'Adminstrador')) {
                        ?>
                        <a href="<?php echo base_url() . 'cadastro/evento'; ?>">Novo Evento</a>
                        <?php
                    }
                }
                $eventos = new Evento();
                $eventos = $eventos->findEventos();
                echo '<br />';
                foreach ($eventos as $evento) {
                    echo $evento->getNome().'<br />';
                }
                ?>
            </div>

        </div>

    </body>
</html>